<!DOCTYPE html>
<html class="login-alone">
<head>
    <title>登录</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link href="./Public/screen.css" media="screen, projection" rel="stylesheet" type="text/css" >
    <link rel="stylesheet" type="text/css" href="./Public/base.css">
    <link rel="stylesheet" type="text/css" href="./Public/reg.css">
    <script src="./Public/jquery.11.min.js"></script>
    <script>
        $(function () {
            $('input[name=vcode]').blur(function () {
                //用户填写的验证码
                var vcode = $(this).val();
                //异步
                $.ajax({
                    //请求方式
                    type:'post',
                    //请求地址
                    url:'index.php?c=Member&a=checkCode',
                    //发送数据
                    data:{code:vcode},
                    success:function (phpData) {
                        if(phpData == 1){
                            $('#codeMsg').html('<span style="color: green;" >验证码正确</span>');
                            $('#sub').attr('disabled',false);
                        }else{
                            $('#codeMsg').html('<span style="color: red;" >&nbsp;&nbsp;&nbsp;您输入的验证码有误</span>');
                            $('#sub').attr('disabled',true);
                        }
                    }
                })
            })

            $('input[name=username]').blur(function () {
                //用户填写的用户名
                var username = $(this).val();
                //异步
                $.ajax({
                    //请求方式
                    type:'post',
                    //请求地址
                    url:'index.php?c=Member&a=checkUser',
                    //发送数据
                    data:{u:username},
                    success:function (data) {
                        if(data == 1){
                            $('#userMsg').html('<span style="color: red;" > 该账户已被注册！</span>');
                            $('#sub').attr('disabled',true);
                        }else if(data == 3){
                            $('#userMsg').html('<span style="color: red;" ></span>');
                            $('#sub').attr('disabled',true);
                        }else{
                            $('#userMsg').html('<span style="color: green;" > 恭喜！用户名可用！</span>');
                            $('#sub').attr('disabled',false);
                        }
                    }
                })
            })
            $('input[name=password2]').blur(function () {
                //用户填写的密码
                var password2 = $(this).val();
                var password1 = $('input[name=password]').val();
                if(password1 != password2){
                    $('#psw').html('<span style="color: red;" > 两次输入的密码不一致</span>');
                    $('#sub').attr('disabled',true);
                }else{
                    $('#psw').html('<span style="color: green;" ></span>');
                    $('#sub').attr('disabled',false);
                }
            })
        })
    </script>
</head>
<body>
<div class="logina-logo" style="">
</div>
<div class="logina-main main clearfix">
    <div class="tab-con">
        <h1 style="text-align: center;font-size: 20px">用户注册</h1>
        <form id="form-login" method="post" action="">
            <div id='login-error' class="error-tip"></div>
            <table border="0" cellspacing="0" cellpadding="0">
                <tbody>
                <tr>
                    <th>账户</th>
                    <td width="400">
                        <input id="email" required="" type="text" name="username" placeholder="电子邮箱/手机号" autocomplete="off" value=""><span id="userMsg"></span></td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th>密码</th>
                    <td width="245">
                        <input id="password" required="" type="password" name="password" placeholder="请输入密码" autocomplete="off">
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <th>确认密码</th>
                    <td width="245">
                        <input id="password" required="" type="password" name="password2" placeholder="请确认密码" autocomplete="off"><span id="psw"></span>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr id="tr-vcode"  >
                    <th>验证码</th>
                    <td width="245">
                        <div class="valid">
                            <input required="" type="text" placeholder="验证码" name="vcode"><img id="code" class="vcode" src="?a=code" width="89" height="35" alt=""><br />
                            <a id="re" href="javascript:;">看不清，换一张</a> <span id="codeMsg"></span>
                        </div>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr class="find">
                    <th></th>
                    <td>
                        <div>
<!--                            <label class="checkbox" for="chk11"><input style="height: auto;" id="chk11" type="checkbox" name="remember_me" >记住我</label>-->
                            <a href="index.php">返回首页</a>
                        </div>
                    </td>
                    <td></td>
                </tr>
                <tr>
                    <th></th>
                    <td width="245"><input class="confirm" id="sub" type="submit" value="注   册"></td>
                    <td></td>
                </tr>
                </tbody>
            </table>
            <input type="hidden" name="refer" value="site/">
        </form>
    </div>
    <!--<div class="reg">
        <p>还没有账号？<br>赶快免费注册一个吧！</p>
        <a class="reg-btn" href="#">立即免费注册</a>
    </div>-->
</div>
<div id="footer">
    <div class="copyright"><?php echo date('Y-m-d',time()) ?> class70</div>
</div>
<!--<script src="res/skin/js/lib/jquery-2.0.3.min.js?v=3.9"></script>
<script src="res/skin/js/ui.common.js?v=3.9"></script>
<script src="res/passport/js/login.js?v=3.9"></script>      -->
<script type="text/javascript">
    oCode = document.getElementById("code");
    oRe = document.getElementById("re");
    var src =  oCode.src;
    oRe.onclick = function(){
        oCode.src = src + '&mt=' + Math.random();
    }
    oCode.onclick = function(){
        oCode.src = src + '&mt=' + Math.random();
    }

</script>
</body>
</html>
